<template>
  <div class="pickScanTaskDetail">
    <van-nav-bar title="任务详情查" left-text="返回" @click-left="onClickLeft"></van-nav-bar>
    <van-row>
      <van-col span="10" align="center">
        <van-cell title="商品" />
      </van-col>
      <van-col span="10" align="center">
        <van-cell title="库位" />
      </van-col>
      <van-col span="4" align="center">
        <van-cell title="应拣" />
      </van-col>
    </van-row>
    <div v-for="(item, index) in detailList" :key="index">
      <van-row class="pick-scan-list">
        <van-col span="10" align="center">
          <span>{{ item.sku }}</span>
        </van-col>
        <van-col span="10" align="center">
          <span>{{ item.locationCode }}</span>
        </van-col>
        <van-col span="4" align="center">
          <span>{{ item.pickQty }}</span>
        </van-col>
      </van-row>
    </div>
  </div>
</template>

<script>
import {mapGetters} from "vuex";
import {getAllPickLogByTaskId} from "@/api/pickScan/pickTask";

export default {
  name: "b2cPickScanTaskDetail",
  computed: {
    ...mapGetters("scanner", ["pdaScanData"]),
    ...mapGetters("user", ["userData"]),
    storerId() {
      return this.$root.storerWarehouseBrand.storerId;
    },
    warehouseId() {
      return this.$root.storerWarehouseBrand.warehouseId;
    },
    brandId() {
      return this.$root.storerWarehouseBrand.brandId;
    }
  },
  created() {
    this.getAllPickLogByTaskId();
  },
  data() {
    return {
      detailList: []
    };
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    //查询拣货任务详情
    getAllPickLogByTaskId() {
      if (!this.$route.query.pickTaskId) {
        return;
      }
      let params = {
        storerId: this.storerId,
        warehouseId: this.warehouseId,
        brandId: this.brandId,
        picktaskId: this.$route.query.pickTaskId
      };

      getAllPickLogByTaskId(params)
        .then(response => {
          if (response.data.status) {
            this.detailList = response.data.data;
          } else {
            this.$toast.fail(response.data.message);
          }
        })
        .catch(() => {
          this.$toast.fail("请求出错！");
        });
    }
  }
};
</script>
<style scoped lang="less">
.pickScanTaskDetail {
  /deep/ .pick-scan-notice.van-notice-bar {
    padding: 4px 16px;
    line-height: 20px;
  }
  .pick-scan-list {
    /deep/ .van-col {
      font-size: 14px;
      padding: 8px 4px;
      span {
        word-break: break-all;
        word-break: break-word;
      }
    }
    .text-center {
      text-align: center;
    }
  }
}
</style>
